<?php if (!defined('THINK_PATH')) exit();?><style>
    #wtxx label,#wtcl label,#cxxx label,#wtyz label,{
        display:block;
        padding:5px 0 5px 10px;
    }
    #wtxx div,#wtcl div,#cxxx div,#wtyz div{
        padding: 5px 0 3px 15px;
    }
    .zlpic{
        width:230px;
        padding: 5px;
    }
</style>
<div  class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',title:'',split:false,border:false" style="height:70px;background-color: #EBF2FF;">
        <style>
#finaBox{
	display: none;

}
	.finaSeDiv{
		float:left;
		padding:10px 0 5px 10px;
		width:200px;
	}
	.finaSeDiv2{
		float:left;
		padding:10px 0 5px 10px;
		/*width:200px;*/
	}
	.finaSeDiv label,.finaSeDiv2 label{
		width:53px;
		float: left;
	}
	.table-btn-separator {
    float: center;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #fff;
  /*  width: 1200px;*/
}
    #zl_tool{
        float: left;

    }
</style>

<div id="zl_tool">

<table style="float: left;">
<tr  style="float: left;">
	<td>
		<?php if(authCheck1('Home/Zhiliang/showadd')): ?><a href="#" id= "aaa1" class="easyui-linkbutton"  onclick='show_add_zl()' data-options="iconCls:'icon-standard-folder-page',plain:true">添加</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zhiliang/del')): ?><a href="#" class="easyui-linkbutton"  onclick='dele()' data-options="iconCls:'icon-standard-page-white-delete',plain:true">删除</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zhiliang/edit')): ?><a href="#" class="easyui-linkbutton"  onclick='show_edit_zl()' data-options="iconCls:'icon-standard-application-edit',plain:true">编辑</a><?php endif; ?>
	</td>
	<?php if(authCheck1('Home/Zhiliang/add,Home/Zhiliang/del,Home/Zhiliang/edit',1,1,'and')): ?><td>
			<div class="datagrid-btn-separator"></div>
		</td><?php endif; ?>
	<?php if(authCheck1('Home/Zhiliang/showchuli')): ?><td>
			<a href="#" class="easyui-linkbutton"  onclick='add_zg()' data-options="iconCls:'icon-standard-application-edit',plain:true">添加整改</a>
		</td><?php endif; ?>

	<td>

	        <a href="#"  class="easyui-linkbutton"   onclick="excel()" data-options="iconCls:'icon-standard-page-white-excel',plain:true">导出</a>

	        <!--<a href="#" class="easyui-linkbutton"  onclick="view()" data-options="iconCls:'icon-standard-application-view-gallery',plain:true">查看</a>-->
	    <?php if(authCheck1('Home/Zhiliang/showyanzheng')): ?><a href="#" class="easyui-linkbutton"  onclick="show_yanzheng()" data-options="iconCls:'icon-standard-building-add',plain:true">验证</a><?php endif; ?>
	</td>
	<td>
    	<div class="datagrid-btn-separator"></div>
	</td>
   	<td>
	  <a href="#" class="easyui-linkbutton"  onclick="reload()" data-options="iconCls:'icon-standard-arrow-refresh',plain:true">刷新</a>
   	</td>
	<td>
	     <div class="datagrid-btn-separator"></div>
	</td>
	<td>
		<div style="float:right;">
			<input id='searchbox_zl' class="easyui-searchbox" data-options="" style="width:400px;"></input>
		</div>


		<div id="mm" style="width:400px">
			<div data-options="name:'content',iconCls:'icon-standard-table-edit',selected:true">问题描述</div>

			<div data-options="name:'todo',iconCls:'icon-standard-table-edit'">问题处理</div>
		</div>
	</td>
	   	 <td>
     <div class="datagrid-btn-separator"></div>
 </td>
 	 <td>
       <a href="#" id="finaSearch" class="easyui-linkbutton"  onclick="zlxx_finaSearch()" data-options="iconCls:'icon-search',plain:true">显示高级搜索</a>
 </td>


</tr>

    <tr style="float: left;">
        <td>
            车间：<input id="cj_add_tool" name="cj" class="easyui-textbox"
                      data-options="iconCls:'',editable:true,required:false,panelHeight:'auto'"
                      style="width:80px"/>
            工段：
            <select id="dw_tool" class="easyui-combobox" name="dw" style="width:80px;"
                    data-options="editable:false,required:false,panelHeight:'auto'">
                <option value="">.</option>
                <option value="1">一工段</option>
                <option value="2">二工段</option>

            </select>
            工位：
            <input id="gw_add_tool" class="easyui-combogrid" data-options="editable:false,required:false"
                   name="gw" style="width:80px;"/>

            <a href="#" id="" class="easyui-linkbutton"  onclick="zlxx_earch()" data-options="iconCls:'icon-search',plain:true">搜索</a>
        </td>
		<td>
			<div class="datagrid-btn-separator"></div>
		</td>
		<td>日期:

            <input  name="finddate" id="f_creatdates"   type= "text" class= "easyui-datebox" style="width:100px"/>  到
            <input  name="finddatee" id="f_creatdatee"   type= "text" class= "easyui-datebox" style="width:100px"/>
            <a  href="#" onclick="finSerZhiliangBtn()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
        </td>
    </tr>


</table>





</div>

<script>
    $('#cj_add_tool').combobox({
        valueField: 'id',
        url: APP+'/Admin/Trem/cjList',
        textField: 'title',
        editable: false,
        onSelect: function (rec) {
            $('#gw_add_tool').combogrid({
                panelWidth: 200,
                idField: 'title',
                textField: 'title',
                multiple: true,
                striped: true,
                url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                columns: [[
                    {field: 'title', title: '名称', width: 120}
                ]]
            });
            $('#gw_add').combobox('clear');
        }
    });


    function add_zg(){
        var row = $('#zl_dg').datagrid("getSelected");
        if (row) {
            // 如果已经验证，就不能再添加整改
            if(row.status=='已验证') {
                $.messager.alert('提示',"您的分析与整改措施已经被验证，不能再重复添加！", "info");
            }else{
                console.log(row.fx);
                if(row.status=='待处理') {
                    // 如果已经处理，询问是否覆盖
                    var tab = $('#tab').tabs('getSelected');
                    tab.panel('refresh', APP+'/Home/Zhiliang/showchuli?id='+row.id);
                }else{
                    $.messager.confirm('确认','您的分析与整改措施已经添加，是否重新添加！',function(r){
                        if (r){
                            // 如果已经处理，询问是否覆盖
                            var tab = $('#tab').tabs('getSelected');
                            tab.panel('refresh', APP+'/Home/Zhiliang/showchuli?id='+row.id);
                        }
                    });

                }
            }

        } else {
            $.messager.alert("请选择", "请选择要处理的项目！", "info");
        }
    }

    function  show_yanzheng(){
        var row = $('#zl_dg').datagrid("getSelected");
        if (row) {
            if(row.status=="待处理") {
                $.messager.alert("提醒", "此质量信息还没有回复处理，请联系车间处理后再进行验证！", "info");
            }
            if(row.status=='已验证') {
                $.messager.confirm('确认', '此质量问题已经验证，是否重新验证！', function (r) {
                    if (r) {
                        // 如果已经处理，询问是否覆盖
                        var tab = $('#tab').tabs('getSelected');
                        tab.panel('refresh', APP + '/Home/Zhiliang/showyanzheng?id=' + row.id);
                    }
                });
            }
            if(row.status=='已处理') {
                var tab = $('#tab').tabs('getSelected');
                tab.panel('refresh', APP+'/Home/Zhiliang/showyanzheng?id='+row.id);
            }




        } else {
            $.messager.alert("请选择", "请选择要验证的项目！", "info");
        }
    }
    /**
     * [show_add_zl 显示添加界面]
     * @return {[type]} [description]
     */
    function show_add_zl() {

        var tab = $('#tab').tabs('getSelected');
        tab.panel('refresh', APP+'/Home/Zhiliang/showadd');
    }
    function show_edit_zl() {
        var row = $('#zl_dg').datagrid("getSelected");
        if (row) {
            if(row.fx=='' || row.fx==null) {

                $("#chuliDia").dialog("open").dialog('setTitle', '&nbsp;&nbsp;编辑质量信息');

                $("#edit_zl_form").form("load", row);
            }
            else{
                $.messager.alert("提示", "车间已经对问题进行回复与分析，不能进行编辑！", "info");
			}
        } else {
            $.messager.alert("请选择", "请选择要删除的项目！", "info");
        }  var row = $('#zl_dg').datagrid("getSelected");
        if (row) {
            if(row.fx=='' || row.fx==null) {

                $("#chuliDia").dialog("open").dialog('setTitle', '&nbsp;&nbsp;编辑质量信息');

                $("#edit_zl_form").form("load", row);
            }
            else{
                $.messager.alert("提示", "车间已经对问题进行回复与分析，不能进行编辑！", "info");
			}
        } else {
            $.messager.alert("请选择", "请选择要删除的项目！", "info");
        }
    }

    /**
 * [finaSearch 高级搜索显示]
 * @return {[type]} [description]
 */
function zlxx_finaSearch(){
        $("#zlxx_finlsearch").dialog("open").dialog('setTitle', '&nbsp;&nbsp;质量信息高级搜索');
}
/**
 * [finSerBtn 高级搜索]
 * @return {[type]} [description]
 */



function zlxx_earch(){
    $('#zl_dg').datagrid('load',{
        cj:$("#cj_add_tool").combobox('getValue'),
        gw:$("#gw_add_tool").combobox('getValue'),
        dw:$("#dw_tool").combobox('getValue'),
    });
    }

    function finSerZhiliangBtn(){
        $('#zl_dg').datagrid('load',{
            finddate:$("#f_creatdates").datebox('getValue'),
            finddatee:$("#f_creatdatee").datebox('getValue')
        });
    }
</script>
    </div>
    <div data-options="region:'east',iconCls:'icon-reload',title:'问题处理',split:true" style="width:260px;">
        <div  id="wtclTab" class="easyui-tabs" data-options="fit:true,border:false">
    <div title="问题处理" data-options="fit:true,border:false">
        <form id="wtcl">
             <div>
                    <label >责任车间:</label>
                    <input id="cj_xx" name="cj" class="easyui-textbox"
                           data-options="readonly:true,iconCls:'',editable:true,panelHeight:'auto'"
                           style="width:200px;"/>
                </div>
                <div>
                    <label >责任工位:</label>
                    <input id="gw_xx"  class="easyui-textbox" type="text" name="gw" data-options="readonly:true,editable:false"
                           style="width:200px;"/>
                </div>
            <div>
                <label >责任工段:</label>

                <select id="dw" class="easyui-combobox" name="dw" style="width:200px;"
                        data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                    <option value="0" selected="selected">/</option>
                    <option value="1">一工段</option>
                    <option value="2">二工段</option>

                </select>
            </div>
            <div>
                <label >原因分析:</label>
                <input class="easyui-textbox" type="text" name="fx" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >整改措施:</label>
                <input class="easyui-textbox" type="text" name="todo" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >整改完成时间:</label>
                <input class="easyui-textbox" type="text" name="overdate" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >责任人:</label>
                <input class="easyui-textbox" type="text" name="zrr" data-options="editable:false"
                       style="width:200px;"/>
            </div>


        </form>
    </div>
    <div title="处理图片" id="cltp" data-options="fit:true,border:false">


    </div>
    <div title="验证信息" data-options="fit:true,border:false">
        <form id="wtyz">
            <div>
                <label >流水号:</label>
                <input class="easyui-textbox" type="text" name="yzlsh" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >验证结果:</label>
                <input class="easyui-textbox" type="text" name="yzresult" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >验证结果备注:</label>
                <input class="easyui-textbox" type="text" name="yzresultbz" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >验证日期:</label>
                <input class="easyui-textbox" type="text" name="yzdate" data-options="editable:false"
                       style="width:200px;"/>
            </div>
        </form>
    </div>

</div>

    </div>
    <div data-options="region:'west',title:'问题信息',split:true" style="width:260px;">
        
    <div  id="wtxxTab" class="easyui-tabs" data-options="fit:true,border:false">

        <div title="问题信息" data-options="fit:true,border:false">
            <form id="wtxx">
            <div>
                <label >发布人:</label>
                <input class="easyui-textbox" type="text" name="nickname" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >稽查内容名称/零部件名称:</label>
                <input class="easyui-textbox" type="text" name="content" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >文件编号:</label>
                <input class="easyui-textbox" type="text" name="fileid" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >工艺要求:</label>
                <input class="easyui-textbox" type="text" name="gy" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >问题描述:</label>
                <input class="easyui-textbox" type="text" name="discr" data-options="editable:false,multiline:true"
                       style="width:200px;height:80px;"/>
            </div>
            <div>
                <label >图片:</label>
                <div id="wtxxpic"></div>
            </div>
            <div>
                <label >问题类别:</label>


                <select id="lb" class="easyui-combobox" name="lb" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                <option value="1">三检</option>
                <option value="2">一致性问题</option>
            </select>

            </div>
            <div>
                <label >问题项目:</label>
                <select id="xm" class="easyui-combobox" name="xm" style="width:200px;" data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                    <option value="1">线管路问题</option>
                    <option value="2">错漏装</option>
                    <option value="3">三漏问题</option>
                    <option value="4">外观质量问题</option>
                    <option value="5">松装（力矩不足、力矩未检测）</option>
                    <option value="6">未做标记（标记不规范</option>
                    <option value="7">未执行“三按”</option>
                    <option value="10">其它</option>
                </select>
            </div>
            <div>
                <label >三检执行情况:</label>
                <input class="easyui-textbox" type="text" name="sj" data-options="editable:false,readonly:true"
                       style="width:200px;"/>
            </div>
                <div>
                    <label >是否合格:</label>
                    <select id="result" class="easyui-combobox" name="result" style="width:200px;" data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                        <option value="合格">合格</option>
                        <option value="不合格" selected="selected">不合格</option>
                    </select>
                </div>



            </form>
        </div>
        <div title="车型信息" data-options="closable:false,border:false" style="">
            <form id="cxxx">
            <div>
                <label >车型:</label>
                <input class="easyui-textbox" type="text" name="cx" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >计生号:</label>
                <input class="easyui-textbox" type="text" name="jsh" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            <div>
                <label >流水号:</label>
                <input class="easyui-textbox" type="text" name="lsh" data-options="editable:false"
                       style="width:200px;"/>
            </div>
                <div>
                    <label >责任车间:</label>
                    <input id="cj_xx" name="cj" class="easyui-textbox"
                           data-options="readonly:true,iconCls:'',editable:true,panelHeight:'auto'"
                           style="width:200px;"/>
                </div>
                <div>
                    <label >责任工位:</label>
                    <input id="gw_xx"  class="easyui-textbox" type="text" name="gw" data-options="readonly:true,editable:false"
                           style="width:200px;"/>
                </div>
            <div>
                <label >责任工段:</label>

                <select id="dw" class="easyui-combobox" name="dw" style="width:200px;"
                        data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                    <option value="0" selected="selected">/</option>
                    <option value="1">一工段</option>
                    <option value="2">二工段</option>

                </select>
            </div>
            <div>
                <label >任务来源:</label>
                <select  class="easyui-combobox" name="ly" style="width:200px;"
                        data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                    <option value="0" selected="selected">/</option>
                    <option value="1">X3000专项</option>
                    <option value="2">载货车专项</option>
                    <option value="3">大模块水箱问题</option>
                    <option value="4">中联重科专项</option>
                    <option value="5">三一重工专项</option>
                    <option value="6">中石油专项</option>
                    <option value="7">非专项填写</option>
                </select>

            </div>
            <div>
                <label >是否重复:</label>

                <select id="cf" class="easyui-combobox" name="repeat" style="width:200px;"
                        data-options="readonly:true,editable:false,required:true,panelHeight:'auto'">
                    <option value="1" selected="selected" value="非">非</option>
                    <option value="2">是</option>
                </select>
            </div>
            <div>
                <label >稽查日期:</label>
                <input class="easyui-textbox" type="text" name="finddate" data-options="editable:false"
                       style="width:200px;"/>
            </div>
            </form>
        </div>
        <div id="zltp" title="图片" data-options="closable:false,border:false" style="">

        </div>

    </div>
    <script>
        $('#cj_xx').combobox({
            valueField: 'id',
            url: APP+'/Admin/Trem/cjList',
            textField: 'title',
            editable: false,
            onSelect: function (rec) {
                $('#gw_xx').combogrid({
                    panelWidth: 200,
                    idField: 'title',
                    textField: 'title',
                    multiple: true,
                    striped: true,
                    url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                    columns: [[
                        {field: 'title', title: '名称', width: 120}
                    ]]
                });
                $('#gw_xx').combobox('clear');
            }
        });

    </script>

    </div>
    <div data-options="region:'center',title:''" style="padding:5px;background:#eee;">
        <table id="zl_dg"></table>

    </div>
</div>
<!--工具栏1 -->


<style>
    .uploadpic {
        float: left;
        width: 295px;
        text-align: center;
        height: 165px;
    }

    .uploadpic h3 {
        text-align: left;
        border: 1px solid #95B8E7;
        float: left;
        padding: 4px;
        background-color: #95B8E7;
        color: #FFF;
    }

    .up-content {
        border: 1px solid #95B8E7;
        padding: 4px;
    }

    .w10 {
        float: left;
        width: 10px;
        color: #FFF;
    }

    .items {
        padding: 10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }

    #dd div {
        padding-right: 10px;
        padding-bottom: 10px;
    }

    .addItems {
        float: left;
    }

    /*表格样式  */
    .add_table {
        width: 100%;
        border: 1px solid #0e90d2;
    }

    .add_table th {
        width: 80px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right: solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }

    .add_table td {
        border-bottom: solid 1px #95B8E7;
    }

    .add_table tr {
        border: solid 1px #95B8E7;
    }

    .tb_head {
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }

    .inline {
        display: inline;
        padding-right: 5px;
    }

    .row_container {
        padding: 8px 5px 5px 5px;
    }


    .edit_zl_title{
        font-size: 20px;
        color: #0e2d5f;
        text-align: center;
        padding: 10px;
        font-weight: bold;
    }
</style>
<div id="chuliDia" class="easyui-dialog" style="width:1050px; height: 450px; padding: 0px; overflow: hidden;" title="添加整改信息" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-chuli',closed:true,resizable:false,modal:true,closable:true">

    <form id="edit_zl_form" action="" enctype="multipart/form-data" method="post" style="padding:10px;">
        <table class="add_table">
            <tr>
                <th>生产信息</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline">
                            <span class="add_label">稽查日期：</span>
                            <input id="edit_creatdate" name="finddate" class="easyui-datebox"
                                   data-options="required:true,showSeconds:true" style="width:120px" value="<?php echo ($finddate); ?>"/>
                        </div>
                        <div class="inline">
                            <span class="add_label">车间：</span>
                            <input id="cj_edit" name="cj" class="easyui-textbox"
                                   data-options="iconCls:'',editable:true,required:true,panelHeight:'auto'"
                                   style="width:100px" />
                        </div>
                        <div class="inline">
                            <span class="add_label">工位：</span>
                            <input id="gw_edit" class="easyui-combogrid" data-options="editable:false,required:true"
                                   name="gw" style="width:200px;" />


                        </div>

                        <div class="inline">
                            <span class="add_label">工段：</span>
                            <select id="dw" class="easyui-combobox" name="dw" style="width:100px;"
                                    data-options="editable:false,required:true,panelHeight:'auto'">
                                <option value="0" selected="selected" >/</option>
                                <option value="1">一工段</option>
                                <option value="2">二工段</option>

                            </select>


                        </div>

                        <div class="inline">
                            <span class="add_label">任务来源：</span>
                            <select id="ly" class="easyui-combobox" name="ly" style="width:100px;"
                                    data-options="editable:false,required:true,panelHeight:'auto'" value="<?php echo ($ly); ?>">>
                                <option value="0">/</option>
                                <option value="1">X3000专项</option>
                                <option value="2">载货车专项</option>
                                <option value="3">大模块水箱问题</option>
                                <option value="4">中联重科专项</option>
                                <option value="5">三一重工专项</option>
                                <option value="6">中石油专项</option>
                                <option value="7">非专项填写</option>
                            </select>
                        </div>



                    </div>
                </td>
            </tr>
            <th>基本信息</th>
            <td style="background-color:rgba(204, 204, 204, 0.4);">
                <div class="row_container">

                    <div class="panel" style="display: block;">
                        <div class="easyui-panel panel-body panel-body-noheader" style="padding: 5px; width: 100%;"
                             title="">
                            <span class="add_label">流水号</span>
                            <input id="lshpp" class="easyui-textbox" data-options=""/>
                            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                               onclick="pipei()">匹配</a>
                            <span class="add_label">车型：</span>
                            <input id="cx" name="cx" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px" value="<?php echo ($cx); ?>"/>

                            <span class="add_label">计生号：</span>
                            <input id="jsh" name="jsh" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px" value="<?php echo ($jsh); ?>"/>

                            <span class="add_label">流水号区间：</span>
                            <input id="lshqj" name="lsh" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px" value="<?php echo ($lsh); ?>"/>
                        </div>
                    </div>
                </div>



            </td>
            </tr>
            <!--<tr>-->
            <!--<th>文件编号</th>-->
            <!--<td>-->
            <!--&lt;!&ndash; textarea name="chuli" class="easyui-textbox" id="chuli" style="width: 100%; height: 46px;" onkeyup="" data-options="required:true"></textarea> &ndash;&gt;-->
            <!--<input id="fileid" name="fileid" class="easyui-textbox"-->
            <!--data-options="multiline:false,editable:true,prompt:'请输入文件编号……',required:true"-->
            <!--style="width:60%;">-->
            <!--<br/>-->
            <!--</td>-->
            <!--</tr>-->
            <tr>
                <th>稽查内容名称/零部件名称</th>
                <td>
                    <textarea name="content" class="easyui-textbox" id="content" style="width: 100%; height: 46px;"
                              data-options="required:true"  ><?php echo ($content); ?></textarea>
                    <br/>
                </td>
            </tr>
            <tr>
                <th>工艺要求</th>
                <td>
                    <textarea name="gy" class="easyui-textbox" id="gy" style="width: 100%; height: 46px;"
                              data-options="required:true" ><?php echo ($gy); ?></textarea>
                    <br/>
                </td>
            </tr>
            <tr>
                <th>问题描述</th>
                <td>
                    <textarea name="discr" class="easyui-textbox" id="discr" style="width: 100%; height: 46px;"
                              data-options="required:true"><?php echo ($discr); ?></textarea>
                    <br/>
                </td>
            </tr>



<!--asdasdasdasdad-->
            <tr>
                <th>问题类别/问题项目</th>
                <td>
                    <!-- textarea name="chuli" class="easyui-textbox" id="chuli" style="width: 100%; height: 46px;" onkeyup="" data-options="required:true"></textarea> -->
                    问题类别:<select id="lb" class="easyui-combobox" name="lb" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                    <option value="1">三检</option>
                    <option value="2">三不</option>
                    <option value="3">三按</option>
                </select>

                    项目:
                    <select id="xm" class="easyui-combobox" name="xm" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="1">管路打折</option>
                        <option value="9">缺捆扎、固定</option>
                        <option value="11">干涉</option>
                        <option value="12">间隙小</option>
                        <option value="13">装调问题</option>


                        <option value="2">错漏装</option>
                        <option value="3">三漏问题</option>
                        <option value="4">外观质量问题</option>
                        <option value="5">松装（力矩不足、力矩未检测）</option>
                        <option value="6">未做标记（标记不规范</option>
                        <option value="7">未执行“三按”</option>
                        <option value="8">一致性</option>
                        <option value="10">其它</option>
                    </select>
                    三检执行情况：
                    <select id="sj" class="easyui-combobox" name="sj" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="未自检">未自检</option>
                        <option value="未互检">未互检</option>
                        <option value="未专检">未专检</option>
                        <option value="弄虚作假">弄虚作假（自检、互检、专检）</option>
                        <option value="比例不足（自检、互检、专检）">比例不足（自检、互检、专检）</option>
                        <option value="合格填写（已自检、已互检、已专检）">合格填写（已自检、已互检、已专检）</option>
                    </select>
                    <select id="result" class="easyui-combobox" name="result" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="合格">合格</option>
                        <option value="不合格" selected="selected">不合格</option>
                    </select>
                    <br/>
                </td>
            </tr>
            <tr>
                <th>备注</th>
                <td>

                    <textarea name="beizhu" class="easyui-textbox" id="beizhu" style="width: 100%; height: 46px;" onkeyup=""
                              data-options=""><?php echo ($beizhu); ?></textarea>
                    <br/>
                </td>
            </tr>
        </table>
        <input type="hidden" name="id" id="id_edit">
        <input type="hidden" name="userid" id="userid" value=<?php echo ($_SESSION['uid']); ?>>
        <input type="hidden" name="author" id="author" value=<?php echo ($_SESSION['uname']); ?>>
        <input type="hidden" name="nickname" id="nickname" value=<?php echo ($_SESSION['unickname']); ?>>
    </form>
</div>
<div id="dlg-chuli">

    <a href="#"  class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
       onclick="bianji()">确认</a>
    <a href="#"  class="easyui-linkbutton" onclick='clearForm()'
       data-options="iconCls:'icon-standard-coins-delete',plain:true">清空</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-cancel'"
       onclick="javascript:$('#chuliDia').dialog('close')">取消</a>
</div>

<script>

    $(function(){
        // $('#cj_add').combobox('select', '<?php echo ($cj); ?>');
    })

    function bianji(){
        $('#edit_zl_form').form('submit', {

            url :APP+ '/Home/Zhiliang/edit',

            success : function(data) {
                data = $.parseJSON(data);
                console.log(data)
                if(data.status==1){
                    $('#edit_zl_form').form('clear');
                    $.messager.confirm('确认',data.msg+'是否要关闭编辑界面',function(r){
                        if (r){
                            $('#chuliDia').dialog('close');
                        }
                    });
                }else{
                    $.messager.alert('错误', data.msg, 'info');
                }

            }
        });
    }
function clearForm(){
    $.messager.confirm('确认','您确认想要清空记录吗？',function(r){
        if (r){
            $('#edit_zl_form').form('clear');
        }
    });
}

    $('#cj_edit').combobox({
        valueField: 'id',
        url: APP+'/Admin/Trem/cjList',
        textField: 'title',
        editable: false,
        onSelect: function (rec) {
            $('#gw_edit').combogrid({
                panelWidth: 200,
                idField: 'title',
                textField: 'title',
                multiple: true,
                striped: true,
                url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                columns: [[
                    {field: 'title', title: '名称', width: 120}
                ]]
            });
            // $('#gw_add').combobox('clear');
            $('#gw_add').combogrid('setValue','');
        }
    });


    // 匹配MES信息
    function pipei() {

        // 匹配之前西安清空
        $('#lshqj').textbox('clear');
        $('#jsh').textbox('clear');
        $('#cx').textbox('clear');
        $('#pt').textbox('clear');
        $('#jhms').textbox('clear');
        $('#cxch').textbox('clear');
        $('#jxh').textbox('clear');
        // $('#fkbm').textbox('clear');
        var lsh = $('#lshpp').textbox('getText');
        if (lsh != "") {
            $.post("/degs/index.php/Home/Quality/pipei", {lsh: lsh}, function (result) {
                // $("span").html(result);
                console.log(result);
                if (result.status == '1') {
                    $('#lshqj').textbox('setValue', result.data.lshqj);
                    $('#jsh').textbox('setValue', result.data.sjjhh);
                    $('#cx').textbox('setValue', result.data.cl);
                    $('#pt').textbox('setValue', result.data.jss);
                    $('#jhms').textbox('setValue', result.data.cjpz);
                    $('#cxch').textbox('setValue', result.data.cxch);
                    $('#jxh').textbox('setValue', result.data.jxh);
                    var leibie = $('#leibie').combobox('getValue');
                    if (leibie == 'sj') {
                        $('#fkbm').combobox('setValue', result.data.fkbm);
                    } else {
                        $('#fkbm').combobox('setValue', '');
                    }


                } else {
                    $.messager.alert('匹配车型信息', result.data, 'info');
                }

            }, "json");
        } else {
            $.messager.alert('匹配车型信息', '请输入流水号', 'info');
        }
    }


</script>



<div id="showpic" class="easyui-dialog" style="width:650px;height:550px;padding:2px;overflow:hidden;" title="&nbsp;&nbsp;显示图片" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-view',closed:true,resizable:true,modal:true,closable:true">
	<div id="pic_content" style="width:100%;height:100%;text-align:center;vertical-align: center"></div>
</div>



<div id="dlg-view">
	<div class="tool_tip">
		单击右键以保存图片！！

	</div>

	<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#showpic').dialog('close')">取消</a>
</div>

// <script>
// 	$('#pic_content').smartZoom({
// 					'containerClass' : 'zoomableContainer'
// 				}); 
// </script>


<style>
    .finaSeDiv{

    }
</style>
<div id="zlxx_finlsearch" class="easyui-dialog" style="width: 728px; height: 275px; padding: 0px; overflow: hidden;" title="&nbsp;&nbsp;质量信息全局搜索" data-options="iconCls:'icon-search',buttons:'#zlxx_finlsearch_btn',closed:true,resizable:false,modal:true,closable:true">
    <table  id="zlxx_finaBox" style="">
        <tr>
            <td>
                <div class="finaSeDiv">
                    <label >发布人:</label>
                    <input class="easyui-textbox" type="text" name="nickname" id="f_nickname" style="width:130px;">
                </div>
            </td>
            <td>
                <div class="finaSeDiv">
                    <label >稽查内容名称/零部件名称:</label>
                    <input class="easyui-textbox" type="text" name="content" id="f_content" style="width:130px;">
                </div>
            </td>
            <td>
                <div class="finaSeDiv">
                    <label >工艺要求:</label>
                    <input class="easyui-textbox" type="text" name="gy" id="f_gy"style="width:130px;">
                </div>

            </td>
        </tr>
        <tr>
            <td>
                <div class="finaSeDiv">
                    <label >问题描述:</label>
                    <input class="easyui-textbox" type="text" name="discr" id="f_discr" style="width:130px;">
                </div>
            </td>
            <td>
                <div class="finaSeDiv">
                    <label >问题类别:</label>
                    <select  class="easyui-combobox" name="lb" id="f_lb" style="width:130px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="" selected="selected" >.</option>
                        <option value="1">三检</option>
                        <option value="2">一致性问题</option>
                    </select>

                </div>
            </td>
            <td>
                <div class="finaSeDiv">
                    <label >问题项目:</label>
                    <select  class="easyui-combobox" name="xm" id="f_xm" style="width:130px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="" selected="selected" >.</option>
                        <option value="1">线管路问题</option>
                        <option value="2">错漏装</option>
                        <option value="3">三漏问题</option>
                        <option value="4">外观质量问题</option>
                        <option value="5">松装（力矩不足、力矩未检测）</option>
                        <option value="6">未做标记（标记不规范</option>
                        <option value="7">未执行“三按”</option>
                        <option value="10">其它</option>
                    </select>
                </div>

            </td>

        </tr>
        <tr>
            <td>
                <div class="finaSeDiv">
                    <label >三检执行情况:</label>
                    <select id="f_sj" class="easyui-combobox" name="sj" style="width:130px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="" selected="selected" >.</option>
                        <option value="未自检">未自检</option>
                        <option value="未互检">未互检</option>
                        <option value="未专检">未专检</option>
                        <option value="弄虚作假">弄虚作假（自检、互检、专检）</option>
                        <option value="比例不足（自检、互检、专检）">比例不足（自检、互检、专检）</option>
                        <option value="合格填写（已自检、已互检、已专检）">合格填写（已自检、已互检、已专检）</option>
                    </select>
                </div>
            </td>
            <td>
                <div class="finaSeDiv">
                    <label >是否合格:</label>
                    <select id="f_result" class="easyui-combobox" name="result" style="width:130px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="" selected="selected" >.</option>
                        <option value="合格">合格</option>
                        <option value="不合格">不合格</option>
                    </select>
                </div>

            </td>
        <td>
            <div class="finaSeDiv">
                <label >问题备注:</label>
                <input class="easyui-textbox" type="text" name="beizhu" id="f_beizhu" style="width:130px;">
            </div>
        </td>
        </tr>
        <tr>
            <td>
                <div class="finaSeDiv">
                    <label >整改措施:</label>
                    <input class="easyui-textbox" type="text" name="todo" id="f_todo" style="width:130px;">
                </div>
            </td>

            <td>
                <div class="finaSeDiv">
                    <label >验证流水号:</label>
                    <input class="easyui-textbox" type="text" name="yzlsh" id="f_yzlsh" style="width:130px;">
                </div>
            </td>
        </tr>

    </table>
</div>
<div id="zlxx_finlsearch_btn">
    <div class="tool_tip">
        输入要搜索的内容进行搜索!
    </div>
    <a id="finSerBtn" href="#" onclick="finSerBtn_zlxx()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#zlxx_finlsearch').dialog('close')">取消</a>
</div>

<script>

    function finSerBtn_zlxx(){
            $('#zl_dg').datagrid('load',{
                nickname:$("#f_nickname").val(),
                content:$("#f_content").val(),
                gy:$("#f_gy").val(),
                discr:$("#f_discr").val(),
                result:$('#f_result').combobox('getValue'),
                lb:$('#f_lb').combobox('getValue'),
                xm:$('#f_xm').combobox('getValue'),
                sj:$('#f_sj').combobox('getValue'),
                beizhu:$("#f_beizhu").val(),
                yzlsh:$("#f_yzlsh").val(),
                todo:$("#f_todo").val()
            });
    }
</script>




<style>
.detailtb td{
		/*background-color: rgba(133, 134, 136, 0.14);*/
		border: 1px solid #ccc;

	}
	.ditTitle{
		width:60px;font-weight:bold;color:#0E2D51;
		background-color: #F3F3F3;
	
	}
	.hfs{
		text-align: center;
		font-weight: bold;
		padding: 5px 0;
		color:#0E2D51;
		background-color: #F4F4F4
	}
	.hfr{
		font-weight: bold;
		padding-left:5px; 
	}
	.hfnr{
		padding:5px 2px 5px 15px; 
	}
	/*细节栏中的图片缩略图*/
	.picsl{
		width: 40px;
		padding:0 5px;
	}
	.picsl:hover{
		border:solid 1px #95B8E7;
		width: 35px;
		cursor: hand;
	}
	.pics2{
		max-width: 150px;
		max-height: 90px;
		padding:0 5px;

	}
</style>
<!-- 图片缩放穿件 -->
<script type="text/javascript">
    function showpic(url) {
        im = document.createElement('img');
        im.src=url;

        var pic='<img src="'+url+'" alt="图片" style="max-height:500px;max-width:600px"/>';

        $('#showpic').window('open');

        $("#pic_content").html(pic);
    }

    function pic(tp,cla){
        var tp=escape2Html(tp.replace(/\\\//g,'/'));
        var tp=$.parseJSON(tp);
        var pics="";
        for(var pici in tp){
            pics='<img src="/degs/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/degs/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
        }
        return pics;
    }
    $('#zl_dg').datagrid({
        url: APP + '/Home/Zhiliang/read',
        // toolbar: '#tool',
        pagination: true,
        fit: true,
        width: function () {
            return document.body.clientWidth * 0.9
        },
        nowrap: true,//
        collapsible: true,
        fitColumns: false,
        autoRowHeight: false,
        striped: true,//交替行
        singleSelect: true,//只允许选择一行
        rownumbers: true,
        border: false,
        sortName: 'id',
        sortOrder: 'desc',//倒序排列
        remoteSort: false,
        pageSize: 30,
        method: "post",
        pageList: [10, 15, 30, 40, 50, 100, 200, 500, 1000],
        columns: [[
            {
                field: 'id',
                checkbox: true
            },{
            field: 'cj',
            title: '责任车间',
            width: 80 ,

            formatter: function (value, row, index) {
                var str=['','装配车间','内饰车间','调试车间','试制车间'];

                value=parseInt(value);
                return str[value];
            }
        }
            , {
                field: 'dw',
                title: '责任工段',
                width: 80,
                formatter: function (value, row, index) {
                    var str=['','一工段','二工段'];
                    value=parseInt(value);
                    return str[value];
                }
            }, {
                field: 'gw',
                title: '责任工位',
                width: 80
            },
             {
                field: 'status',
                title: '状态',
                width: 80,
                align: 'left'
            },

            {
                field: 'userid',
                title: '发布人',
                hidden: 'true',
                align: 'center'
            },
            

            {
                field: 'nickname',
                title: '发布人',
                width: 60
            },
            {
                field: 'content',
                title: '稽查内容名称/零部件名称',
                width: 200
            },
{
                field: 'discr',
                title: '问题描述',
                width: 300
            },
            {
                field: 'gy',
                title: '工艺要求',
                width: 240
            }, {
                field: 'pics',
                title: '图片',
                width: 60,
                align: 'center',
                formatter: function(value,row,index){
                    if (value){
                        return "<img  src='/degs/Public/jquery-easyui-1.4.5/themes/icons/icon-standard/16x16/accept.png' alt='' />";
                    } else {
                        return "";
                    }
                }
            }, {
                field: 'lb',
                title: '问题类别',
                width: 80,
                align: 'left',
                formatter: function (value, row, index) {
                    var str=['三检','三不','三按'];
                    value=parseInt(value)-1;

                    return str[value];
                }
            }
            , {
                field: 'xm',
                title: '问题项目',
                width: 80,
                align: 'left',
                formatter: function (value, row, index) {
                    var str=['管路打折','错漏装','三漏问题','外观质量问题','松装（力矩不足、力矩未检测）','未做标记（标记不规范）','未执行“三按”','一致性','缺捆扎、固定','其它','干涉'];
                    value=parseInt(value)-1;
                    return str[value];
                }

            }
            , {
                field: 'sj',
                title: '三检执行情况',
                width: 80
            }
            , {
                field: 'result',
                title: '稽查结果',
                width: 80
            }, {
                field: 'cx',
                title: '车型',
                width: 80
            }, {
                field: 'jsh',
                title: '计生号',
                width: 120
            }, {
                field: 'lsh',
                title: '流水号',
                width: 120
            }, {
                field: 'ly',
                title: '任务来源',
                width: 80,
                formatter: function (value, row, index) {
                    var str=['','X3000专项','载货车专项','大模块水箱问题','中联重科专项','三一重工专项','中石油专项','非专项填写'];
                    value=parseInt(value);
                    return str[value];
                }
            }
            , {
                field: 'repeat',
                title: '是否重复',
                width: 80,
                formatter: function (value, row, index) {
                    var str=['','非','是'];
                    value=parseInt(value);
                    return str[value];
                }
            }, {
                field: 'finddate',
                title: '稽查日期',
                width: 80
            }, {
                field: 'fx',
                title: '原因分析',
                width: 150,
                formatter: function (value, row, index) {

                    // return cj(value);
                }
            }, {
                field: 'todo',
                title: '整改措施',
                width: 150
            }
            , {
                field: 'overdate',
                title: '整改完成时间',
                width: 80
            }
            , {
                field: 'zrr',
                title: '责任人',
                width: 80
            }
            , {
                field: 'yzlsh',
                title: '流水号',
                width: 80
            }
            , {
                field: 'yzresult',
                title: '验证结果',
                width: 80
            }
            , {
                field: 'yzdate',
                title: '验证日期',
                width: 80
            }


        ]],
        rowStyler: function(index,row){
            if (row.status=='待处理'){
                return 'background-color:#FFCCCC;color:#304c80;';
                // rowStyle是一个已经定义了的ClassName(类名)
            }else{
                return 'background-color:#CCFFCC;color:#304c80;';
            }
        },
        onClickRow:function(rowIndex, rowData){
            $('#wtxx').form('load',rowData);
            $('#wtcl').form('load',rowData);
            $('#wtyz').form('load',rowData);

            $('#cxxx').form('load',rowData);
            // 添加图片显示
            $('#zltp').html();
            cla='zlpic';

            var tp=rowData.pics;
            if(tp!=null){
                tp=escape2Html(tp.replace(/\\\//g,'/'));
                tp=$.parseJSON(tp);
                var pics="";
                for(var pici in tp){
                    pics='<img src="/degs/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/degs/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
                }
                $('#zltp').html(pics);
            }else{
                $('#zltp').html('');
            }

// 处理图片显示
            $('#cltp').html();
            cla='zlpic';
            var tp=rowData.chuli_pics;
            if(tp!=null){
                tp=escape2Html(tp.replace(/\\\//g,'/'));
                tp=$.parseJSON(tp);
                var pics="";
                for(var pici in tp){
                    pics='<img src="/degs/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/degs/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;
                }
                $('#cltp').html(pics);
            }else{
                $('#cltp').html('');
            }


        },
        onDblClickRow: function (rowIndex, rowData) {
            // console.log(rowData);


            if (rowData) {
                $("#view").dialog("open").dialog('setTitle', '&nbsp;&nbsp;查看记录');
                view();


            } else {
                console.log("没有数据！");
            }
        },

        onLoadSuccess: function () {
            // $(".grid_pic").linkbutton({
            // 	text : '&nbsp;&nbsp;显示',
            // 	plain : true,
            // 	iconCls : 'icon-standard-picture'
            // });
            $('#zl_dg').datagrid('doCellTip', {cls: {'background-color': '#EAF1FF'}, delay: 600});
        }
    });



    $('#searchbox_zl').searchbox({
        searcher : function(value, name) {


            switch (name)
            {
                case 'content':
                    $('#zl_dg').datagrid('load',{
                        content:value
                    });
                    break;
                case 'todo':
                    $('#zl_dg').datagrid('load',{
                        todo:value
                    });
                    break;


            }
        },
        menu : '#mm',
        prompt : '请输入搜索内容'
    });

//格式化图片下载
function pic(tp,cla){
var tp=escape2Html(tp.replace(/\\\//g,'/'));
var tp=$.parseJSON(tp);
var pics="";
for(var pici in tp){
		pics='<img src="/degs/Public/'+tp[pici].savename+'" alt="'+tp[pici].name+'" onclick="showpic(\'/degs/Public/'+tp[pici].savename+'\')" class="'+cla+'">'+pics;	
	}
	return pics;
}

function escape2Html(str) {
 var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
 return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
}
// 格式化回复
function hfFormat(str){
	if(str.length!=0){
	var data=$.parseJSON(str);

	var huifu="";
	for(var item in data){
		huifu='<span class="hfr">'+data[item].uname+'：['+data[item].time+']</span><div class="hfnr">'+data[item].huifu+'</div>'+huifu;	
	}
	huifu='<div class="hfs">回复</div>'+huifu;
}else{
	huifu="";
}
	return huifu;		
}
// 格式化回复
function hfFormat2(str){
	if(str.length!=0){
	var data=$.parseJSON(str);

	var huifu="";
	for(var item in data){
		huifu='<span class="hfr">'+data[item].uname+'：['+data[item].time+']</span><div class="hfnr">'+data[item].huifu+'</div>'+huifu;	
	}
	// huifu='<div class="hfs">回复</div>'+huifu;
}else{
	huifu="";
}
	return huifu;		
}
function banci(bc){
	var banci1="";

	if(bc=='day'){
		 banci1="白班";
		}else{
			 banci1="夜班";
		}
	
		return banci1;
}
// 格式化类别
function leibie(val){
	var leibie="";
	switch(val)
	{
	case "lbj":
	  leibie="零部件";
	  break;
	 case "sj":
	  leibie="设计";
	  break;
	case "gy":
	  leibie="工艺";
	  break;
	case "zp":
	  leibie="装配";
	  break;
	  case "bzj":
	  leibie="标准件";
	  break;


	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车型平台
// //   <option value="F3000">F3000</option>
//                     <option value="M3000">M3000</option>
//                     <option value="X3000">X3000</option>
//                     <option value="STR">奥龙</option>
//                     <option value="PZ">偏置</option>
//                     <option value="KY">矿用</option>
//                     <option value="QT">其他</option>
function pt(val){
	var leibie="";
	switch(val)
	{
	case "F3000":
	  leibie="F3000	";
	  break;
	  	case "M3000":
	  leibie="M3000";
	  break;
	 case "X3000":
	  leibie="X3000";
	  break;
	case "STR":
	  leibie="奥龙";
	  break;
	case "PZ":
	  leibie="偏置";
	  break;
	  case "KY":
	  leibie="矿用";
	  break;
	  case "QT":
	  leibie="其他";
	  break;
  case "JUN":
	  leibie="军车";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车辆类型
 // <option value="1">载货车</option>
 //                    <option value="2">越野车</option>
 //                    <option value="3">自卸车</option>
 //                    <option value="4">牵引车</option>
 //                    <option value="5">专用车</option>
 //                    <option value="6">其他</option>
function cx(val){
	var leibie="";
	switch(val)
	{
	case "1":
	  leibie="载货车";
	  break;
	case "2":
	  leibie="越野车";
	  break;
	case "3":
	  leibie="自卸车";
	  break;
	case "4":
	  leibie="牵引车";
	  break;
	case "5":
	  leibie="专用车";
	  break;
	  case "6":
	  leibie="其他";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
// 格式化车间
// <option value=""></option>
//                     <option value="zp1">装配一车间</option>
//                     <option value="zp2">装配二车间</option>
//                     <option value="sz1">试制一车间</option>
//                     <option value="sz2">试制二车间</option>
//                     <option value="ts">调试车间</option>
//                     <option value="yl">预留区</option>
function cj(val){
	var leibie="";
	switch(val)
	{
	case "zp1":
	  leibie="装配一车间";
	  break;
	case "zp2":
	  leibie="装配二车间";
	  break;
	case "sz1":
	  leibie="试制一车间";
	  break;
	case "sz2":
	  leibie="试制二车间";
	  break;
	case "ts":
	  leibie="调试车间";
	  break;
	  	case "ns":
	  leibie="内饰车间";
	  break;
	  case "yl":
	  leibie="预留区";
	  break;

	default:
	   leibie="其他";
	}
		return leibie;
}
	//对Date的扩展，将 Date 转化为指定格式的String 
	//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符， 
	//年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 
	//例子： 
	//(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 
	//(new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18 
	Date.prototype.Format = function(fmt) { //author: meizz 
		var o = {
			"M+" : this.getMonth() + 1, //月份 
			"d+" : this.getDate(), //日 
			"h+" : this.getHours(), //小时 
			"m+" : this.getMinutes(), //分 
			"s+" : this.getSeconds(), //秒 
			"q+" : Math.floor((this.getMonth() + 3) / 3), //季度 
			"S" : this.getMilliseconds()
		//毫秒 
		};
		if (/(y+)/.test(fmt))
			fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "")
					.substr(4 - RegExp.$1.length));
		for ( var k in o)
			if (new RegExp("(" + k + ")").test(fmt))
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
						: (("00" + o[k]).substr(("" + o[k]).length)));
		return fmt;
	}
	//今天、昨天 白班 夜班
	//打开添加窗口

	function showupload() {
		$('#showupload').window('open'); // open a window 	
	}



//显示当前日期
formatterDate = function (date) {
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
+ (date.getMonth() + 1);
var hor = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
return date.getFullYear() + '-' + month + '-' + day+" "+hor+":"+min+":"+sec;
};


function showpic(url) {
	im = document.createElement('img');
	im.src=url;

var pic='<img src="'+url+'" alt="图片" style="max-height:500px;max-width:600px"/>';

 $('#showpic').window('open');
	
$("#pic_content").html(pic);	
}



	function reload() {
		$('#zl_dg').datagrid('reload', {
		    cx: '' 
		});
	}
	function add() {
 // $("#addok").linkbutton("disable");
		$('#add_form').form('submit', {

			url : '/degs/index.php/Home/Quality/add_quality',

			success : function(data) {
				$("#dg").datagrid("reload");

				$.messager.alert('添加项目', data, 'info');
				$('#add').dialog('close')

			}
		});
	}

	//删除		
	function dele() {
		var row = $('#zl_dg').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		


			if (row) {
                if (row.userid == "<?php echo ($_SESSION[ 'uid']); ?>" || $.inArray("1", group_id)!=-1 || $.inArray("2", group_id)!=-1)  {
                if(row.fx=='' || row.fx==null) {
				$.messager.confirm('确认', '您确定要删除此项目吗?', function(r) {
					if (r) {
						$.post(APP+'/Home/Zhiliang/del', {
							id : row.id
						}, function(data) {

                            if (data.status==1) {
								$.messager.alert('删除项目', data.msg, 'info');
								$("#zl_dg").datagrid("reload");
                                $('#wtxx').form('clear');
                                $('#wtcl').form('clear');
                                $('#cxxx').form('clear');
                                $('#wtyz').form('clear');
                                $('#zltp').html('');
                                $('#cltp').html('');
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : result.errorMsg
								});

							}
						}, 'json');
					}
				});
                }else{
                    $.messager.alert("提示", "车间已经对问题进行恢复与分析，不能删除！", "info");
                }
                } else {

                    $.messager.alert("无法删除", "此服务记录非您创建，无法删除！", "info");
                }
			} else {
				$.messager.alert("请选择", "请选择要删除的项目！", "info");
			}



	}


 	function edit() {
		$('#edit_form').form('submit', {
			type:'POST',
			 url : APP+'/Home/Zhiliang/edit',
			success : function(data) {

				$('#edit').dialog('close')
				$("#dg").datagrid("reload");
				$.messager.alert('编辑质量信息', data, 'info');
				// 

			}
		});
	} 

	function page() {
		return $('#dg').datagrid('options').pageNumber;
	}
	function pagesize() {
		return $('#dg').datagrid('options').pagesize;
	}
	function excel() {
		
		var grid = $('#zl_dg');
		var options = grid.datagrid('getPager').data("pagination").options; 
		var pageNumber = options.pageNumber;
		var pageSize=options.pageSize; 
		window.location.href=APP+'/Home/Zhiliang/out/page/'+pageNumber+'/pagesize/'+pageSize;
	}

</script>